module bpt #(parameter ADDRESS_WIDTH = 32,
			 parameter TABLE_WIDTH = 4)
			(input [ADDRESS_WIDTH-1:0] branchAddressEX,
			 input [TABLE_WIDTH-1:0] branchIndex,
			 input [ADDRESS_WIDTH-1:0] branchAddressID,
			 input clk,
			
			 output [ADDRESS_WIDTH-1:0] branchPrediction);
	
	reg [ADDRESS_WIDTH-1:0] Table[0:(2**TABLE_WIDTH)-1];
	
	integer i;
	initial
		for (i = 0; i < (2**TABLE_WIDTH); i = i + 1)
			Table[i] <= (1 << (ADDRESS_WIDTH - 1)) ^ -1; //fill with MAX_INT
	
	assign branchPrediction = Table[branchAddressID];
	always @(posedge clk)
		Table[branchIndex] = branchAddressEX;
endmodule